# -*- coding: utf_8 -*-
# @Create   : 2021/9/18 11:28
# @Author   : yh
# @Remark   : 定时任务server层
from mxsoftpy import Server

from db.common.Base.timed_task import TimedTaskDB
from model.common.Base.timed_task import TimedTaskModel


class TimedTaskServer(Server):
    __model__ = TimedTaskModel
    __db__ = TimedTaskDB

    def delete(self, code: str, **kwargs):
        """
        删除定时任务
        :param code: 要删除的任务code
        """
        self.db.delete(code, {'state': 0})
